﻿using System;
using System.Windows.Input;

namespace Colorful.Control.Controls
{
    public class ChoiceCommand : ICommand
    {
        public event EventHandler CanExecuteChanged;

        private readonly string automationId;
        private readonly ButtonCommandHandler commandHandler;
        private readonly bool isCancel;
        private readonly bool isDefault;
        private readonly string label;
        private readonly MessageChoice result;

        public ChoiceCommand(ButtonCommandHandler commandHandler, bool isDefault, bool isCancel, string label, string automationId, MessageChoice result)
        {
            this.commandHandler = (ButtonCommandHandler)Delegate.Combine(this.commandHandler, commandHandler);
            this.isDefault = isDefault;
            this.isCancel = isCancel;
            this.label = label;
            this.automationId = automationId;
            this.result = result;
        }
       
        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
            commandHandler(this);
        }

        public string AutomationId
        {
            get { return automationId; }
        }

        public bool IsCancel
        {
            get { return isCancel; }
        }

        public bool IsDefault
        {
            get { return isDefault; }
        }

        public string Label
        {
            get { return label; }
        }

        public MessageChoice Result
        {
            get { return result; }
        }
    }
}
